home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / misc / man2rtf / man2rtf.doc < prev    next >
Text File  |  1999-11-30  |  6KB  |  149 lines

  1.     Copyright 1990 by Norman Graham, Brandywine Softworks.
  2.  
  3.     Permission to use, copy, modify, and distribte this software for
  4.     any purpose and without fee is hereby granted, provided that the
  5.     above copyright notice appear in all copies and that both the
  6.     copyright notice and this permission notice and warranty disclaimer
  7.     appear in supporting documentation, and that the name of Brandywine
  8.     Softworks or Norman Graham not be used in advertising or publicity
  9.     pertaining to distribution of the software without specific, written
  10.     prior permission.
  11.  
  12.     Brandywine Softworks and Norman Graham disclaim all warranties with
  13.     regard to this software, including all implied warranties of
  14.     merchantability and fitness. In no event shall Brandywine Softworks
  15.     or Norman Graham be liable for any special, indirect, or consequential
  16.     damages or any damages whatsoever resulting from loss of use, data,
  17.     or profits, whether in an action of contract, negligence, or other
  18.     tortious action, arising out of or in connection with the use or
  19.     performance of this software.
  20.  
  21.  
  22.  
  23.     File:   Man2RTF.c
  24.     Author: Norman Graham
  25.     Date:   2 September 1990
  26.  
  27.     Usage:  Man2RTF [-f|-h8|-h7] <Man.file >RTF.File
  28.  
  29.     Description:
  30.  
  31.         Man2RTF is a quick hack to convert a text file to Rich Text Format.
  32.         It converts some of the control sequences common in Un*x files into
  33.         the equivalent RTF character formatting. It converts the following
  34.         sequences:
  35.  
  36.             "a\ba"          =>  Bold 'a'
  37.             "a\ba\ba"       =>  Bold 'a'
  38.             "a\ba\ba\ba"    =>  Bold 'a'
  39.             "_\ba"          =>  Underlined 'a'
  40.             "_\ba\ba"       =>  Underlined Bold 'a'
  41.             "`"             =>  Typographer's Opening Single Quote
  42.             "'"             =>  Typographer's Closing Single Quote
  43.  
  44.         Any other string with a '\b' in it is written to stderr as an error.
  45.         The idea is that Man2RTF will tell you when you need to extend it
  46.         to handle control sequences not currently handled.
  47.  
  48.         Any non-control sequence is just copied to the RTF file.
  49.  
  50.  
  51.     Options:
  52.  
  53.         -f  Format the text with 10 point Courier and format the page
  54.             to display 66 lines on a vertical 8.5 inch by 11 inch page.
  55.             Margins are Top = 0.45 inch, Bottom = 0.45 inch, and
  56.             Left = 1.25 inches.
  57.  
  58.         -h8 Format the text with 8 point Courier and format the page
  59.             to display two columns of 66 lines on a horizontal 8.5 inch
  60.             by 11 inch page. Margins are Top = 0.21 inch, Bottom = 0.21 inch,
  61.             Left = 0.15 inch, and Right = 0.15 inch with 0.15 inch between
  62.             columns. This format is not as useful as '-h7'.
  63.  
  64.         -h7 Format the text with 7 point Courier and format the page
  65.             to display two columns of 66 lines on a horizontal 8.5 inch
  66.             by 11 inch page. Margins are Top = 0.9 inch, Bottom = 0.45 inch,
  67.             Left = 0.45 inch, and Right = 0.45 inch with 0.8 inch between
  68.             columns. This is a nice format because it provides a top margin
  69.             for binding and the space between columns is large enough that
  70.            you need not worry about the columns running together.
  71.  
  72.         If no option is specified, Man2RTF will only generate font style
  73.         information; it will not generate font name, font size, or
  74.         page formating information.
  75.  
  76.  
  77.     Caveats:
  78.  
  79.         If you use this tool on a Un*x box with the intention of
  80.         downloading the resulting file to your Mac, you need to
  81.         be aware that the resulting file probably contains typographer's
  82.         opening and closing quotes. These characters have values > 127
  83.         (i.e. their high bits are set), thus you'll need to make special
  84.         arangements to download the file. I'd suggest using mcvert
  85.         (available on sumex-aim) to convert the file to a macbinary
  86.         text file and then do a macbinary file transfer. As an alternative,
  87.         you could just nullify the typographer quote code by changing
  88.         kOpenSingleQuote to '`' and kCloseSingleQuote to '\''.
  89.  
  90.  
  91.     MPW build commands:
  92.  
  93.         In MPW, you can build Man2RTF by executing the following commands
  94.         directly from this file. You'll need to edit the Link command
  95.         to put the tool where you want it and to repair the line continuation
  96.         characters that undoubtly will be munged by transport over the
  97.         internet.
  98.  
  99.         C  "{Active}"
  100.  
  101.         Link -w -c 'MPS ' -t MPST       6
  102.             "{Active}".o                6
  103.             "{CLibraries}"StdClib.o     6
  104.             "{CLibraries}"CInterface.o  6
  105.             "{Libraries}"Stubs.o        6
  106.             "{CLibraries}"CRuntime.o    6
  107.             "{Libraries}"Interface.o    6
  108.             -o {MPW}Tools:LocalTools:Man2RTF
  109.  
  110.         Delete "{Active}".o
  111.  
  112.  
  113.     Porting:
  114.  
  115.         This program is written in ANSI C. If your compiler does not
  116.         support the ANSI C standard, you will need to modify this code.
  117.         Pay attention to the function prototypes, the new style function
  118.         definitions, and the string concatenation [used in calls to fprintf()
  119.         and puts()]. I believe most C compilers now support enum types,
  120.         but if yours doesn't you'll need to do some modifications here
  121.         as well.
  122.  
  123.         For MPW users. Watch out for munged characters in the Link
  124.         command (from above) and in the definitions of kOpenSingleQuote
  125.         and kCloseSingleQuote. These definitions contain characters
  126.         that are > 127 (i.e. their high bit is set).
  127.  
  128.  
  129.     Bugs:
  130.  
  131.         As with most quick hacks, the internals of this program are almost
  132.         completely undocumented. But it is a very simple program and
  133.         experienced C programmers should have no trouble following its
  134.         logic.
  135.  
  136.  
  137.     The following are some simple test strings:
  138.  
  139.         Clear text _U_n_d_e_r_l_i_n_e_ _t_e_x_t Clear text
  140.  
  141.         Clear text BBoolldd  tteexxtt Clear text
  142.  
  143.         Clear text _BB_oo_ll_dd_--_UU_nn_dd_ee_rr_ll_ii_nn_ee_  _tt_ee_xx_tt Clear text
  144.  
  145.         Clear text BBBaaaddd   ttteeexxxttt Clear text
  146.  
  147.         Clear text B_Ba_ad_d _ t_te_ex_xt_t Clear text
  148.  
  149.